/*
 * Copyright (C) 2001-2008  Nishanth Menon <menon.nishanth at gmail dot com>
 *
 * Part of the predict two project done during NITC Final year.
 * Predict2: http://code.google.com/p/predict2/
 * NITC: http://web.nitc.ac.in/~cse/
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  US
 */


/*
 * TransactionResult.java
 *
 * Created on September 27, 2001, 8:50 PM
 */
package GUI;

/**
 *
 * @author  lazarus
 * @version 
 */
public class TransactionResult extends javax.swing.JDialog
{

    /** Creates new form TransactionResult */
    public TransactionResult (java.awt.Frame parent, boolean modal, String IconFile)
    {
        super (parent, modal);
        initComponents (IconFile);
        // pack ();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the FormEditor.
     */
    private void initComponents (String IconFile)
    {                           // GEN-BEGIN:initComponents
        BasePanel = new javax.swing.JPanel ();
        DisplayButton = new javax.swing.JButton ();
        getContentPane ().setLayout (new javax.swing.BoxLayout (getContentPane (), 0));
        setCursor (new java.awt.Cursor (java.awt.Cursor.HAND_CURSOR));
        setTitle ("The Transaction Result");
        setBackground (java.awt.Color.gray);
        setDefaultCloseOperation (javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener (new java.awt.event.WindowAdapter ()
                           {
                           public void windowClosing (java.awt.event.WindowEvent evt)
                           {
                           closeDialog (evt);
                           }
                           }
        );

        BasePanel.setLayout (null);
        // BasePanel.setBorder(new javax.swing.border.EmptyBorder(new
        // java.awt.Insets(1, 1, 1, 1)));
        BasePanel.setBackground (java.awt.Color.black);

        DisplayButton.setIcon (new javax.swing.ImageIcon (IconFile));
        DisplayButton.setToolTipText ("Click this to Quit");
        DisplayButton.setBorderPainted (false);
        DisplayButton.setBackground (java.awt.Color.black);
        DisplayButton.addMouseListener (new java.awt.event.MouseAdapter ()
                                        {
                                        public void mouseClicked (java.awt.event.
                                                                  MouseEvent evt)
                                        {
                                        DisplayButtonMouseClicked (evt);
                                        }
                                        }
        );
        BasePanel.add (DisplayButton);
        DisplayButton.setLocation (0, 0);
        DisplayButton.setSize (DisplayButton.getPreferredSize ());


        getContentPane ().add (BasePanel);

        // pack();
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit ().getScreenSize ();
        java.awt.Dimension dialogSize = getSize ();
        setSize (new java.awt.Dimension (530, 280));
        setLocation ((screenSize.width - 550) / 2, (screenSize.height - 250) / 2);
        setResizable (false);
    }                           // GEN-END:initComponents

    private void DisplayButtonMouseClicked (java.awt.event.MouseEvent evt)
    {                           // GEN-FIRST:event_DisplayButtonMouseClicked
// Add your handling code here:
        System.exit (0);
    }                           // GEN-LAST:event_DisplayButtonMouseClicked

    /** Closes the dialog */
    private void closeDialog (java.awt.event.WindowEvent evt)
    {                           // GEN-FIRST:event_closeDialog
        setVisible (false);
        dispose ();
    }                           // GEN-LAST:event_closeDialog

    /**
    * @param args the command line arguments
    */
    public static void main (String args[])
    {
        new TransactionResult (new javax.swing.JFrame (), true,
                               "images/transaction_failed.jpg").show ();
    }


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel BasePanel;
    private javax.swing.JButton DisplayButton;

    // End of variables declaration//GEN-END:variables

}
